package com.hrvsr.session.useragent;

import java.util.concurrent.BlockingDeque;
import java.util.concurrent.LinkedBlockingDeque;

public class BasicUserAgentPool extends AbstractNotNullUserAgentPool {
	private BlockingDeque<String> userAgentQueue = new LinkedBlockingDeque<String>();

	@Override
	public String poll() {
		String agent = userAgentQueue.poll();
		if (agent != null) {
			userAgentQueue.offer(agent);
			return agent;
		}
		return DEFAUTL_USER_AGENT;
	}

	@Override
	public void offer(String userAgent) {
		userAgentQueue.offer(userAgent);
	}

}
